package SoftwareTesting.Pages;

import SoftwareTesting.Constants;
import org.openqa.selenium.WebDriver;
import static org.junit.Assert.*;

import java.util.Map;

public abstract class BasicPage {
    public String pageUrl = Constants.BasicPageUrl;
    public String title = "";
    public Map<String, Object> vars = SoftwareTesting.Pages.Driver.getVars();
    public WebDriver driver = SoftwareTesting.Pages.Driver.getInstance();
    public void assertIsCurrentPage(){
        assertEquals("页面",pageUrl,driver.getCurrentUrl());
    }
    public void verifyTitle(){
        assertEquals("标题",title,driver.getTitle());
    }
    public void verify(){
        assertIsCurrentPage();
        verifyTitle();
    }
    public boolean isCurrentPage(){
        if(pageUrl.equals(driver.getCurrentUrl()) && title.equals(driver.getTitle())) return true;
        return false;
    }

    public abstract void moveTo();

    ;
}
